#include <iostream>
using namespace std;

//a>0,b>0
int GreatestCommonDivisor(int a,int b){
	if( a>b ){
		int temp = a;
		a = b;
		b = temp;
	}
	while( b%a ){
		int temp = b;
		b = a;
		a = temp%a;
	}
	return a;
}
struct fraction{
	int a,b;
	fraction(int a_,int b_):a(a_),b(b_){
	}
	fraction(){
	}
	fraction operator + (const fraction &f){
		fraction tmp;
		tmp.a = this->a*f.b + f.a*this->b;
		tmp.b = this->b*f.b;
		return tmp;
	}
	fraction operator -(const fraction &f){
		fraction tmp;
		tmp.a = this->a*f.b - f.a*this->b;
		tmp.b = this->b*f.b;
		return tmp;
	}
	fraction operator *(const fraction &f){
		fraction tmp;
		tmp.a = this->a * f.a;
		tmp.b = this->b * f.b;
		return tmp;
	}
	//
	fraction operator /(const fraction &f){
		if( f.a==0 ) return fraction(0,0);//
		else{
			fraction tmp;
			tmp.a = this->a * f.b ;
			tmp.b = this->b * f.a;
			return tmp;
		}
	}
	void showSimple() const {
		if( this->b==0 ) cout<<"Inf";
		else{
			if( this->a==0 ){
				cout << 0;
			}else{
				if( this->a*this->b>0 ){
					int d = this->a/this->b;
					if( this->a%this->b ){
						int c = GreatestCommonDivisor(this->a%this->b,this->b);//
						if( d ) cout<<d<<" ";
						cout<<this->a%this->b/c<<"/"<<this->b/c;
					}else{
						cout<<d;						
					}
				}else{
					cout<<"(";
					int d = this->a/this->b; //cout<<"d="<<d;
					if( this->a%this->b ){
						int c = GreatestCommonDivisor(this->a%this->b,this->b);//cout<<"c="<<c;
						if( d ) {
							cout<<d<<" ";
							if( this->b/c<0 ) cout<<-(-(this->a%this->b/c))<<"/"<<-(this->b/c);
							else cout<<-(this->a%this->b/c)<<"/"<<this->b/c;
							cout<<")";
						}else{
							//cout<<d<<" ";
							if( this->b/c<0 ) cout<<-(this->a%this->b/c)<<"/"<<-(this->b/c);
							else cout<<(this->a%this->b/c)<<"/"<<this->b/c;
							cout<<")";
						}
					}else{
						cout<<d<<")";
					}
				}
			}
		}
	}
};
ostream& operator <<(ostream &o,const fraction &f){
	f.showSimple();
	return o;
}
int main(){
	freopen("in.txt","r",stdin);
	int a,b,c,d;
	scanf("%d/%d %d/%d",&a,&b,&c,&d);
	cout << a<<" "<<b<<" "<<c<<" "<<d<<endl;
//	cin >> a >>b >> c >>d;//
	fraction f1 = fraction(a,b),f2 = fraction(c,d);
	cout<<f1<<" + "<< f2 <<" = "<<f1+f2<<endl;
	cout<<f1<<" - "<< f2 <<" = "<<f1-f2<<endl;
	cout<<f1<<" * "<< f2 <<" = "<<f1*f2<<endl;
	cout<<f1<<" / "<< f2 <<" = "<<f1/f2<<endl;
	return 0;
}
